package com.craiglarman.monopoly.domain;

import java.util.ArrayList;
import java.util.List;

public class Board {

	public static final int TOTAL_SQUARE_COUNT = 40;
	private static final int JAIL_SQUARE_INDEX =10;
	private List<Square> squares= new ArrayList<Square>(TOTAL_SQUARE_COUNT);
	
	public Board()
	{
		for(int i=0; i<TOTAL_SQUARE_COUNT; i++)
		{
			Square s=new Square();
			squares.add(s);
		}
	}
	
	public Square getFirstSquare()
	{
		return squares.get(0);
	}
	
	public int getSquaresSize() {
		return squares.size();
	}

	public Square getSquare(Square oldPos, int diceTotal) {
		int oldIndex=squares.indexOf(oldPos);
		return squares.get((oldIndex+diceTotal)%TOTAL_SQUARE_COUNT);
	}

	public Square getSquareAt(int i) {
		return squares.get(i);
	}
	
	public Square getJailSquare()
	{
		return squares.get(JAIL_SQUARE_INDEX);
	}
}
